/**
 * ProductCategory 业务逻辑实现类
 * @author yanwl
 * @date 2014-08-25
 */
package com.chnbst.bstyun.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.chnbst.bstyun.core.base.BaseService;
import com.chnbst.bstyun.core.common.helper.DaoHelper;
import com.chnbst.bstyun.model.pojo.ProductCategory;
import com.chnbst.bstyun.service.ProductCategoryService;

@Transactional
@Service
public class ProductCategoryServiceImpl extends BaseService implements ProductCategoryService {
	
	//声明日志对象 logback
	private final static Logger logger = LoggerFactory.getLogger(ProductCategoryServiceImpl.class);
	private final static String nameSpace = "com.chnbst.bstyun.mapper.ProductCategoryMapper";
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean deleteProductCategory(Integer productCategoryId) {
		return DaoHelper.delete(nameSpace, "deleteProductCategory", productCategoryId);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean insertProductCategory(ProductCategory productCategory) {
		return DaoHelper.insert(nameSpace, "insertProductCategory", productCategory);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=false)
	@Override
	public boolean updateProductCategory(ProductCategory productCategory) {
		return DaoHelper.update(nameSpace, "updateProductCategory", productCategory);
	}
	
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public ProductCategory selectProductCategoryByProductCategoryId(Integer productCategoryId) {
		return (ProductCategory)DaoHelper.query(nameSpace, "selectProductCategoryByProductCategoryId", productCategoryId);
	}
	
	@SuppressWarnings("unchecked")
	@Transactional(propagation=Propagation.REQUIRED,readOnly=true)
	@Override
	public List<ProductCategory> selectProductCategories() {
		return (List<ProductCategory>)DaoHelper.list(nameSpace, "selectProductCategories", null);
	}
}
